Skip to content

Conversation

@Yavor16
Copy link
Contributor

@Yavor16 Yavor16 commented Jan 5, 2026

No description provided.

@Yavor16 Yavor16 force-pushed the application-shutdown-logic-update branch 2 times, most recently from 31b61f2 to 8da103c Compare January 5, 2026 09:25
instanceShutdownExecutor.execute(applicationGuid, i);
public void execute(String applicationId, int applicationInstanceCount) {
ApplicationShutdownScheduler applicationShutdownScheduler = getApplicationShutdownScheduler();
List<ApplicationShutdown> scheduledApplicationShutdowns = applicationShutdownScheduler.scheduleApplicationForShutdown(applicationId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will happen if count of instances is mistaken or some of existing instances are in crashed/not running state? Will it lead to infinite loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont it will because if an instance has crashed on startup, the instance will delete the scheduled entry from the database so there won't be attempts for shutdown.
also if we scheduled 5 instances for shutdown but in reality there are 3, we will shutdown the intances from 1-3. the entries for shutdown for instance 4 and 5 won't be cleared from the database. when we increase the instances back to 5, the scheduled entries will be cleared from the database.
If we schedule 3 instances but there are 5, only the first 3 will be shutdown. the other 2 won't be shutdown

Comment on lines 69 to 83
private void shutdownApplication(ApplicationShutdown applicationShutdown) {
CompletableFuture.runAsync(() -> {
logProgressOfShuttingDown(applicationShutdown, Messages.SHUTTING_DOWN_APPLICATION_WITH_ID_AND_INDEX);
flowableFacade.shutdownJobExecutor();
})
.thenRun(() -> logProgressOfShuttingDown(applicationShutdown, Messages.SHUT_DOWN_APPLICATION_WITH_ID_AND_INDEX));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible here, exception to be thrown inside the async task, this will impact the DB state in a wrong way. Maybe add FAILED status for such cases.

@stiv03
Copy link
Contributor

stiv03 commented Jan 8, 2026

Also add some unit tests, cause now there is 0.0% Coverage on New Code

@Yavor16 Yavor16 force-pushed the application-shutdown-logic-update branch 2 times, most recently from 4f3dab1 to aea5e01 Compare January 13, 2026 12:33
LMCROSSITXSADEPLOY-3344

# Conflicts:
#	multiapps-controller-process/src/main/java/org/cloudfoundry/multiapps/controller/process/Messages.java

# Conflicts:
#	multiapps-controller-core/src/main/java/org/cloudfoundry/multiapps/controller/core/Messages.java
#	multiapps-controller-web/src/main/java/org/cloudfoundry/multiapps/controller/web/resources/ApplicationShutdownResource.java
@Yavor16 Yavor16 force-pushed the application-shutdown-logic-update branch from aea5e01 to 1879759 Compare January 13, 2026 12:36
@Yavor16 Yavor16 force-pushed the application-shutdown-logic-update branch from 1879759 to 22db5eb Compare January 13, 2026 12:55
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants